/**
 * Tests the Review Class of the Smart Peer Review 
 * program for TCSS 360, Fall 2011.
 */
package tests;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

import java.io.File;

import org.junit.Before;
import org.junit.Test;
import conference.Review;
import conference.Reviewer;

/**
 * Tests the Review Class.
 * @author Katie Park
 * @version 1.0
 */
public class TestReview {
	/**
	 * Test Review object.
	 */
	private Review myReview;
	
	/**
	 * Test Reviewer object.
	 */
	private Reviewer myReviewer;

	/**
	 * Test File object.
	 */
	private File myFile;
	
	/**
	 * Test Title string.
	 */
	private String myTitle;
	
	/**
	 * Sets up necessary objects for tests.
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		myReviewer = new Reviewer("Katie", 
				                 "Park", 
				                 "kpark@u.washington.edu");
		myFile = new File("reviewTest.txt");
		myTitle = "How to speak English.....well?";
		myReview = new Review(myTitle, myFile, myReviewer);
	}
	
/*	 * -Precondition: none.
	 * -Postcondition: super.getTitle() == theTitle.
	 * -Postcondition: super.getFile() == theFile.
	 * -Postcondition: super.getReviewer == theReviewer.
	 * -Postcondition: isDone == true.
*/
	@Test
	//Review test = new Review(myTitle, myFile, myReviewer);
	public void testConstructionTitleFileReviewer() {
		
		assertTrue("test.getTitle() should equal myTitle",
			    	myReview.getTitle() == myTitle );
		
		//We've already created the test object, we don't need to create a new one. - Allison
		//Review title = new Review(myTitle);
		//We need to test the File.
		//assertSame is ideal for testing if objects are the same.
		//assertTrue("title.getTitle() should equal myTitle", test.getTitle() == myTitle);
		assertSame("myFile should equal test.getFile()",
				    myFile, myReview.getFile());
		
		//We already have test object.
		//Review reviewer = new Reviewer(myFirstName, myLastName, myEmail);
		//assertSame is better for testing if objects are the same.
		//asserTrue("reviewer.getReviewer() should equal myReviewer, reviewer.getReviewer() == myReviewer");
		assertSame("myReviewer should equal test.getReviewer",
				    myReviewer,
				    myReview.getReviewer());
		
		//how do i test isdone?
		//my suggestion.....
		assertTrue("just instantiated reviews should be done.",
			    	myReview.isComplete());
	}
	//postcondition : myReview.getReviewer() =  myReviewer
	//postcondition : myReview.getFile() = null
	//postcondition : myReview.getTitle() = null
	//postcondition : myReview.iscompleted() = false
	@Test
	public void testConstructionReviewer() {
		//checking object
		myReview = new Review(myReviewer);
		assertFalse("myReview.isComplete() should be false", 
				myReview.isComplete());
	}
}
